import type { ProColumnsTypes } from '@vh-admin/pro-components/lib/t-table-custom/types';
export const columnsFn = (dictionaries: any): ProColumnsTypes<any>[] => {
  return [
    {
      title: '名称',
      dataIndex: 'name',
      formGroup: 1,
      search: false,
      formItemProps: { rules: [{ required: true }] },
      fieldProps: { maxLength: 20 },
    },
    {
      title: '状态',
      dataIndex: 'status',
      valueType: 'select',
      fieldProps: {
        options: dictionaries.AdminRole.status,
      },
      formItemProps: { rules: [{ required: true }] },
      businessStyle: { type: 'tag' },
    },
    {
      title: '关联账号数量',
      dataIndex: 'access_count',
      search: false,
      hideInForm: true,
      hideInSearch: true,
    },
    {
      title: '节点',
      dataIndex: 'permission',
      search: false,
      hideInForm: true,
      hideInSearch: true,
      ellipsis: true,
    },
    {
      title: '节点',
      dataIndex: 'permission_ids',
      search: false,
      valueType: 'TreeSelectCustom',
      formItemProps: { rules: [{ required: true }] },
      fieldProps: {
        checkedParent: true,
        dropdownStyle: {
          maxHeight: 400,
          overflow: 'auto',
        },
        maxTagCount: 2,
        showCheckedStrategy: true,
        treeCheckable: true,
        treeCheckStrictly: true,
        multiple: true,
        placeholder: '请选择',
        treeDefaultExpandAll: true,
        treeNodeFilterProp: 'title',
        showSearch: true,
        allowClear: true,
        fieldNames: { label: 'title', value: 'id', children: 'children', parentId: 'pId' },
        treeData: dictionaries.AdminPermission.treeData,
      },
      hideInTable: true,
      hideInSearch: true,
    },
    {
      title: '创建时间',
      dataIndex: 'created_at',
      valueType: 'dateTime',
      sorter: true,
      search: false,
      hideInForm: true,
      hideInSearch: true,
    },
  ];
};
